package model.entity;


import mode.Sex;
import model.Personality;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;

@Entity
@Table(name="PERSONS")
public class Person {
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "Sequences")
    @TableGenerator
            (name = "Sequences",
             table = "sequences",
             pkColumnName = "table_name",
             valueColumnName = "pk_value",
             initialValue = 69,
             allocationSize = 110)

    private int id;
    private String name;
    @Column(name = "birthDateStr")
    @Temporal(TemporalType.TIME)
    private Date birthDay;
    @Transient
    private Set<Person> friends;
    @Transient
    private List<Personality> personalities;
    @Transient
    private Collection<Car> cars;
    @Enumerated(EnumType.STRING)
    public Sex sex;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getBirthDay() {
        return birthDay;
    }

    public void setBirthDay(Date birthDay) {
        this.birthDay = birthDay;
    }

    public Set<Person> getFriends() {
        return friends;
    }

    public void setFriends(Set<Person> friends) {
        this.friends = friends;
    }

    public List<Personality> getPersonalities() {
        return personalities;
    }

    public void setPersonalities(List<Personality> personalities) {
        this.personalities = personalities;
    }

    public Collection<Car> getCars() {
        return cars;
    }

    public void setCars(Collection<Car> cars) {
        this.cars = cars;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Sex getSex() {
        return sex;
    }

    public void setSex(Sex sex) {
        this.sex = sex;
    }
}
